<?php

namespace App\Models;

use App\Scopes\TeamScope;
use Illuminate\Database\Eloquent\Model;

/**
 * Class BaseModel
 * @method static Create(array $array)
 * @method static find(int $id)
 * @method static whereIn(string $string, array $SMBIds)
 * @package App\Models
 */
class BaseModel extends Model
{
    const STATUS_YES = 1;
    const STATUS_NON = 2;

    public static function getStatus($status)
    {
        $listArr = [
            self::STATUS_YES => '是',
            self::STATUS_NON => '否',
        ];

        if(!is_null($status)) {
            return $listArr[$status] ?? '';
        }

        return $listArr;
    }

    /**
     * 模型的「启动」方法
     *
     * @return void
    protected static function boot()
    {
        parent::boot();
        //static::addGlobalScope(new TeamScope());
    }
     */

    /**
     * 格式化时间
     * @param \DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

}
